import React from 'react';
import { Link, IndexLink } from 'react-router';
// import $ from 'zepto';

const Sidebar = React.createClass({
  onClick(e) {
    if (e.target.nodeName === 'IMG' && $(e.target).siblings('ul').length === 1) {
      $(e.target).toggleClass('transform90');
      $(e.target).siblings('ul').toggleClass('none');
    }
  },
  render() {
    return (
      <div className="sidebar">
        <ul onClick={this.onClick}>
          <li>
            <img className="pointer" src="/static/dist-static/img/one.png" alt="" />
            <IndexLink to="/" activeClassName="active">测试包侯选池</IndexLink>
            <ul className="none">
              <li><Link to="/testPackage/new" activeClassName="active">上传测试包</Link></li>
            </ul>
          </li>
          <li>
            <img className="pointer" src="/static/dist-static/img/one.png" alt="" />
            <Link to="/testCategory" activeClassName="active">测试类列表</Link>
            <ul className="none">
              <li><Link to="/testCategory/testResult" activeClassName="active">测试类推送结果</Link></li>
            </ul>
          </li>
          <li>
            <img className="pointer" src="/static/dist-static/img/one.png" alt="" />
            <Link to="/official/channel" activeClassName="active">正式渠道列表</Link>
            <ul className="none">
              <li><Link to="/official/channel/new" activeClassName="active">添加渠道</Link></li>
              <li><Link to="/official/package" activeClassName="active">渠道发布结果</Link></li>
            </ul>
          </li>
          <li>
            <img className="pointer" src="/static/dist-static/img/one.png" alt="" />
            <Link to="/operate/pushlog" activeClassName="active">操作记录</Link>
            <ul className="none">
              <li><Link to="/operate/pushlog" activeClassName="active">推送测试记录</Link></li>
              <li><Link to="/operate/channellog" activeClassName="active">渠道发布记录</Link></li>
              <li><Link to="/operate/otherlog" activeClassName="active">其他记录</Link></li>
            </ul>
          </li>
          <li>
            <img src="/static/dist-static/img/one.png" alt="" />
            <Link to="/userManage/userInfo" activeClassName="active">账号管理</Link>
          </li>
        </ul>
      </div>
    );
  }
});

export default Sidebar;
